package com.bao;

import com.bao.jwt.server.EnableAuthServer;
import com.bao.user.annotation.EnableLoginArgResolver;
import com.bao.validator.config.EnableFormValidator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.core.env.ConfigurableEnvironment;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@EnableDiscoveryClient
@EnableAuthServer
@EnableFeignClients(value = {"com.bao"})
@Slf4j
@EnableAspectJAutoProxy(proxyTargetClass = true,exposeProxy = true)
@EnableLoginArgResolver
@EnableFormValidator
public class AuthApplication {
    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(AuthApplication.class, args);
        ConfigurableEnvironment env = application.getEnvironment();
        log.error("应用'{}'运行成功！Swagger：文档：http://{}:{}/doc.html",
                env.getProperty("spring.application.name"),
                InetAddress.getLocalHost().getHostAddress(),
                env.getProperty("server.port")
        );

    }
}
